package ch06.service;

import ch06.dao.UserDao;
import ch06.dao.UserDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userSevice321")
public class UserServiceImpl implements UserService {

   /* @Autowired
    @Qualifier("udao321") // 默认找 userDao*/
    @Resource(name = "udao321")
    private UserDao userDao ;//= new UserDaoImpl();

    @Override
    public int add() {
        System.out.println("userService>>add");
        return userDao.add();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
